<?php

class m131015_182800_create_tbl_menu_item extends CDbMigration
{
    public function up()
    {
        $this->createTable('tbl_menu_item',array(
            'id'=>'pk',
            'title'    =>'string NOT NULL',
            'parent_mid'     =>'int(11) NOT NULL',
            'type'   =>'string  NOT NULL',
            'link_path'   =>'string  NOT NULL',
            'params'   =>'string  DEFAULT 0',
            'position'   =>'int(11)  NOT NULL',
            'status'   =>'boolean  DEFAULT 0',
            'access'   =>'tinyint(4) DEFAULT 1',//tinyint
            'create_time'    =>'datetime DEFAULT NULL',
            'update_time'   =>'datetime DEFAULT NULL',
        ), 'ENGINE=InnoDB');
        $this->addForeignKey('fk_menu_item','tbl_menu_item','parent_mid','tbl_menu','id','CASCADE','RESTRICT');
    }

    public function down()
    {
        $this->dropForeignKey('fk_menu_item','tbl_menu_item');
        $this->dropTable('tbl_menu_item');
    }

    /*
    // Use safeUp/safeDown to do migration with transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}